home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / MacTechNotes / Platforms & Tools / Stand-Alone Code Folder / LazyPassƒ / LazyPass.p < prev    next >
Encoding:
Text File  |  1990-07-14  |  847 b   |  43 lines  |  [TEXT/MPS ]

  1.  
  2. UNIT LazyPass;
  3.  
  4. { This is a stand-alone module which implements the function }
  5. { of determining a circle's area from its circumference.     }
  6.  
  7. INTERFACE
  8.  
  9.     USES
  10.         Types, SAGlobals;
  11.  
  12.     FUNCTION CircleArea (circumference: Real) : Real;
  13.  
  14. IMPLEMENTATION
  15.  
  16.     { Define a variable global to all }
  17.     { of the routines in this unit!   }
  18.     VAR radius : Real;
  19.  
  20.     FUNCTION RadiusSquared : Real;
  21.     FORWARD;
  22.     
  23.     { CircleArea is defined first so that the entry point is }
  24.     { conveniently located at the beginning of the module.   }
  25.         
  26.     FUNCTION CircleArea (circumference: Real) : Real;
  27.     VAR
  28.         A5Ref: A5RefType;
  29.         oldA5: Longint;
  30.     BEGIN
  31.         oldA5 := OpenA5World(A5Ref);
  32.             radius := circumference / (2.0 * Pi);
  33.             CircleArea := Pi * RadiusSquared;
  34.         CloseA5World(oldA5, A5Ref);
  35.     END;
  36.     
  37.     FUNCTION RadiusSquared : Real;
  38.     BEGIN
  39.         RadiusSquared := radius * radius;
  40.     END;
  41.  
  42. END.
  43.